// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

#include "SQLDumpStatement.h"
#include "../../visitor/SQLASTVisitor.h"
#include "SQLExprTableSource.h"
#include "SQLSelect.h"

SQLDumpStatement::SQLDumpStatement()
{
}

SQLSelect_ptr SQLDumpStatement::getSelect()
{
  return select;
}

void SQLDumpStatement::setSelect(SQLSelect_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLDumpStatement));
  }

  this->select = x;
}

SQLExprTableSource_ptr SQLDumpStatement::getInto()
{
  return into;
}

void SQLDumpStatement::setInto(SQLExpr_ptr x)
{
  if (x == nullptr)
  {
    return;
  }

  setInto(SQLExprTableSource_ptr(new SQLExprTableSource(x)));
}

void SQLDumpStatement::setInto(SQLExprTableSource_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLDumpStatement));
  }

  this->into = x;
}

BOOL_ptr SQLDumpStatement::isOverwrite()
{
  return overwrite;
}

void SQLDumpStatement::setOverwrite(BOOL_ptr overwrite)
{
  this->overwrite = overwrite;
}

// @Override
void SQLDumpStatement::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLDumpStatement)))
  {
    if (into != nullptr)
    {
      into->accept(visitor);
    }

    if (select != nullptr)
    {
      select->accept(visitor);
    }
  }
  visitor->endVisit(SharedObject(SQLDumpStatement));
}
